package testservice;

import com.common.core.utils.CopyUtil;
import com.common.core.utils.JsonUtil;
import com.common.core.utils.ReType;
import com.domain.bean.sys.SysRole;
import com.domain.bean.sys.SysUser;
import com.domain.bean.dto.SysRoleVO;
import com.domain.bean.dto.SysUserVO;
import com.google.gson.Gson;
import com.pachong.service.SysRoleService;
import com.pachong.service.SysUserService;
import com.pachong.service.TestService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * 用户测试用例
 */
public class SysUserTest extends BaseTest {
    @Autowired
    SysUserService userService;
    @Autowired
    SysRoleService sysRoleService;





    @Test
    public void test1(){
        userService.deleteByPrimaryKey("2c90889c61dc49b30161dc49d4970000");
        System.err.println("==");
    }

    @Test
    public void test3(){
        SysRole role = new SysRole();
        ReType<SysRole> show = sysRoleService.show(role, Integer.valueOf(1), Integer.valueOf(2));
        List<SysRoleVO> sysRoleVOS = CopyUtil.copyList(show.getData(), SysRoleVO.class);
        ReType<SysRoleVO> shouwReType = new ReType<SysRoleVO>(show.getCount(),sysRoleVOS);
        String s = JsonUtil.toJson(shouwReType);
        System.err.println("查询到符合条件的："+show.getData().size());
        System.err.println("----:"+s);
    }

    @Test
    public void test2(){
        SysUser user = new SysUser();

        ReType<SysUser> show = userService.show(user, 0, 10);
        List<SysUserVO> sysUserVOS = CopyUtil.copyList(show.getData(), SysUserVO.class);
        ReType<SysUserVO> showVo = new ReType<>(show.getCount(),sysUserVOS);
        String s = new Gson().toJson(showVo);
        System.err.println("---:"+s);
        System.err.println("1");
    }

}
